perm filename DVITYP.OCH[TEX,DEK] blob
sn#714554 filedate 1983-06-26 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00007 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 \def\botofcontents{\vfill
C00003 00003 @ The binary input comes from |dvi_file|, and the symbolic output is written
C00005 00004 @ To prepare these files for input, we |reset| them. An extension of
C00007 00005 @ The |input_ln| routine waits for the user to type a line at his or her
C00009 00006 @ If |p=0|, i.e., if no font directory has been specified, \.{DVItype}
C00011 00007 @ The string |cur_name| is supposed to be set to the external name of the
C00014 ENDMK
C⊗;
\def\botofcontents{\vfill
\centerline{(This listing shows the changes for {\sc WAITS} only)}}
\pageno=\contentspagenumber \advance\pageno by 1
\let\maybe=\iffalse
@z
@ The binary input comes from |dvi_file|, and the symbolic output is written
on \PASCAL's standard |output| file. The term |print| is used instead of
|write| when this program writes on |output|, so that all such output
could easily be redirected if desired.
@d print(#)==write(#)
@d print_ln(#)==write_ln(#)
@p @t\4@>@{$D-,W+@} {no debugging overhead}
program DVI_type(@!dvi_file,@!output);
label @<Labels in the outer block@>@/
const @<Constants in the outer block@>@/
type @<Types in the outer block@>@/
var@?@<Globals in the outer block@>@/
procedure initialize; {this procedure gets things started properly}
var i:integer; {loop index for initializations}
begin print_ln(banner);@/
@<Set initial values@>@/
end;
@z
@ To prepare these files for input, we |reset| them. An extension of
\PASCAL\ is needed in the case of |tfm_file|, since we want to associate
it with external files whose names are specified dynamically (i.e., not
known at compile time). The following code assumes that `|reset(f,s)|'
does this, when |f| is a file variable and |s| is a string variable that
specifies the file name. If |eof(f)| is true immediately after
|reset(f,s)| has acted, we assume that no file named |s| is accessible.
@p procedure open_dvi_file; {prepares to read packed bytes in |dvi_file|}
begin reset(dvi_file,'','/B:8');
cur_loc←0;
end;
@#
procedure open_tfm_file; {prepares to read packed bytes in |tfm_file|}
begin reset(tfm_file,cur_name,'/B:8/O/N:19');
end;
@↑system dependencies@>
@z
@ The |input_ln| routine waits for the user to type a line at his or her
terminal; then it puts ascii-code equivalents for the characters on that line
into the |buffer| array. The |term_in| file is used for terminal input,
and |term_out| for terminal output.
@d term_in==tty
@d term_out==tty
@<Glob...@>=
@!buffer:array[0..terminal_line_length] of ascii_code;
@↑system dependencies@>
@z
@ If |p=0|, i.e., if no font directory has been specified, \.{DVItype}
is supposed to use the default font directory, which is a
system-dependent place where the standard fonts are kept.
The string variable |default_directory| contains the name of this area.
@↑system dependencies@>
@d default_directory_name=='[TEX,SYS]' {change this to the correct name}
@d default_directory_name_length=9 {change this to the correct length}
@<Glob...@>=
@!default_directory:packed array[1..default_directory_name_length] of char;
@↑system dependencies@>
@z
@ The string |cur_name| is supposed to be set to the external name of the
\.{TFM} file for the current font. This usually means that we need to
prepend the name of the default directory, and
to append the suffix `\.{.TFM}'. But at {\mc SAIL} we append the
directory name after the font name. And we compress `\.{oldenglish}' to
`\.{oldish}'.
@<Move font name into the |cur_name| string@>=
for k←1 to name_length do cur_name[k]←' ';
r←0;
for k←font_name[nf]+p to font_name[nf+1]-1 do
if (k≤font_name[f]+p+2)∨(k≥font_name[nf+1]-3) then
begin incr(r);
if r+4>name_length then
abort('DVItype capacity exceeded (max font name length=',
name_length:1,')!');
@.DVItype capacity exceeded...@>
if (names[k]≥"a")∧(names[k]≤"z") then
cur_name[r]←xchr[names[k]-@'40]
else cur_name[r]←xchr[names[k]];
end;
cur_name[r+1]←'.'; cur_name[r+2]←'T'; cur_name[r+3]←'F'; cur_name[r+4]←'M';
r←r+4;
if p=0 then for k←1 to default_directory_name_length do
begin incr(r);
if r>name_length then abort('Font name is too long!');
cur_name[r]←default_directory[k];
end
else for k←font_name[nf] to font_name[nf]+p-1 do
begin incr(r);
if r>name_length then abort('Font name is too long!');
if (names[k]≥"a")∧(names[k]≤"z") then
cur_name[r]←xchr[names[k]-@'40]
else cur_name[r]←xchr[names[k]];
end
@↑system dependencies@>
@z